﻿using System;
using System.Collections.Generic;
using System.Linq;
using PureMVC.Patterns;
using GameEngine.Model.Data;
using GameEngine.Libs;

namespace GameEngine.Model
{
    public class LevelDataProxy<ItemVOId> : DataProxy, ILevelDataProxy<ItemVOId>
        where ItemVOId : IComparable<ItemVOId>
    {
        public LevelDataProxy(ILevelVO<ItemVOId> level)
            : base(ILevelDataProxyConstants<ItemVOId>.CreateDataProxyName(level), level)
        {
            Worlds = new Dictionary<IWorldVOId, IWorldDataProxy<ItemVOId>>();
            Paused = true;
        }

        public string LevelName
        {
            get { return VO.Name; }
            set { VO.Name = value; }
        }

        public ILevelVO<ItemVOId> VO {
            get { return Data as ILevelVO<ItemVOId>; }
        }
        
        public IDictionary<IWorldVOId, IWorldDataProxy<ItemVOId>> Worlds
        {
            get;
            set;
        }

        virtual public bool HasEnded() {
            return false;//TODO finish conditions
        }

        public bool Paused { get; set; }

        //public override string Serialize()
        //{
        //    return Serializer.Serialize(this);
        //}
   }
}
